<!DOCTYPE html>
<html lang="zh-CN">    
  <head>
      <meta charset="utf-8">
      <title>
          我的世界你的美
      </title>     
  </head>
  <body bgcolor="#00B2EE">
    <div class="box">
      <h2>标准肝体积计算</h2>
      <b>体重(kg)</b><input type="text" id="gtj_input" class="text1" placeholder="请输入">
      <br>
      <br>
      <b>结果(ml)</b><input type="text" id="gtj_output" class="text2" >
      <br>
      <br>
      <button class="button1" onclick = 'calculator()'><b>计算</b></button> 
      <button class="button2" onclick="clere()"><b>清零</b></button>
    </div>
    <br>
    <br>
    <div>
      <h2>体表面积计算</h2>
      <b>身高(cm)</b><input type="text" id="hight_input" class="text1" placeholder="请输入">
      <b>体重(kg)</b><input type="text" id="wight_input" class="text2" placeholder="请输入">
      <br>
      <br>
      <b>结果(m2)</b><input type="text" id="tbmj_output" class="text3" >
      <br>
      <br>
      <button class="button1" onclick = 'calculator2()'><b>计算</b></button> 
      <button class="button2" onclick="clere2()"><b>清零</b></button>
    </div>
    <script>
     function calculator(){
      var input = document.getElementById("gtj_input").value;
      var output = input*11.508+334.024
      output = Math.round(output * 1000) / 1000
      document.getElementById('gtj_output').value = output
     }
     function clere(){
      document.getElementById("gtj_input").value = "";
      document.getElementById('gtj_output').value = ""
     }
     function calculator2(){
      var hight_input = document.getElementById("hight_input").value;
      var wight_input = document.getElementById("wight_input").value
      var tbmj_output = 0.0061*hight_input+0.0128*wight_input-0.1529
      tbmj_output = Math.round(tbmj_output * 10000) / 10000;
      document.getElementById('tbmj_output').value = tbmj_output
     }
     function clere2(){
      document.getElementById("hight_input").value = "";
      document.getElementById('wight_input').value = "";
      document.getElementById('tbmj_output').value = "";
     }
    </script>
  </body>
</html>
